//
//  QJudgeTopCell.m
//  QoilPublic
//
//  Created by 杨凯 on 16/7/7.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QJudgeTopCell.h"
@interface QJudgeTopCell()




@end
@implementation QJudgeTopCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self setSeparatorInset:UIEdgeInsetsZero];
    [self setLayoutMargins:UIEdgeInsetsZero];
    
    self.bgView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    self.redImage.layer.borderColor = [QColorUtility defaultRedColor].CGColor;
    self.redImage.layer.borderWidth = 0.5;
    self.redImage.layer.cornerRadius = 6;
    self.blueImage.layer.borderColor = [QColorUtility defaultBlueColor].CGColor;
    self.blueImage.layer.borderWidth = 0.5;
    self.blueImage.layer.cornerRadius = 6;
    self.greenImage.layer.borderColor = [UIColor greenColor].CGColor;
    self.greenImage.layer.borderWidth = 0.5;
    self.greenImage.layer.cornerRadius = 6;
    
    _ratingControl = [[AMRatingControl alloc] initWithLocation:CGPointMake(20,5) emptyImage:[UIImage imageNamed:@"statgray_image"] solidImage:[UIImage imageNamed:@"statyellow_image"] andMaxRating:5];
    _ratingControl.starSpacing = 20;
    _ratingControl.starWidthAndHeight = 30;
    _ratingControl.rating = 5;
    self.starImageView.userInteractionEnabled = YES;
    [self.starImageView addSubview:_ratingControl];
    
}

- (void)setMoneyStr:(NSString *)moneyStr{

    _moneyStr = moneyStr;
    self.moneyLabel.text = [NSString stringWithFormat:@"￥%@",self.moneyStr];
}

//- (void)setTimeStr:(NSString *)timeStr{
//
//    _timeStr = timeStr;
//    self.timeLabel.text = [NSString stringWithFormat:@"%@前",self.timeStr];
//
//}

- (void)setModel:(QAllorderListModel *)model{
    _model = model;
    self.timeLabel.text = [NSString stringWithFormat:@"%@",_model.serviceTime];
    
}

- (void)setAddressStr:(NSString *)addressStr{
    _addressStr = addressStr;
    self.addressLabel.text = self.addressStr;
}

//评价详情数据
- (void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    _moneyLabel.text = [NSString stringWithFormat:@"￥%.2f",[_dataDic[@"totalprice"] floatValue]];
   //_timeLabel.text = [NSString stringWithFormat:@"%@前",_dataDic[@"serviceTime"]];
    _timeLabel.text = [NSString stringWithFormat:@"%@-%@",_dataDic[@"startTime"],_dataDic[@"endDate"]];
    _addressLabel.text = _dataDic[@"address"];
    
    NSNumber *nub = _dataDic[@"score"];
    _ratingControl.rating = [nub integerValue];
}

- (void)setIsClick:(BOOL)isClick{

    _isClick = isClick;
    if(_isClick){
        _ratingControl.userInteractionEnabled = YES;
    }else{
        _ratingControl.userInteractionEnabled = NO;
    }
}



@end
